import 'package:baselib/utils/image_util.dart';
import 'package:baselib/utils/navigator_util.dart';
import 'package:baselib/widgets/gradient_card_view.dart';
import 'package:baselib/widgets/gradient_text_widget.dart';
import 'package:baselib/widgets/inkwell_button.dart';
import 'package:flutter/material.dart';
import 'package:framelib/utils/color_util.dart';
import 'package:framelib/utils/drawable_util.dart';
import 'package:framelib/utils/px_util.dart';
import 'package:framelib/utils/string_util.dart';

class SelectGenderWidget extends StatelessWidget {
  Function cancelSelectedFunc;
  Function maleSelectedFunc;
  Function femaleSelectedFunc;
  SelectGenderWidget({Key key,
    this.cancelSelectedFunc,this.maleSelectedFunc,this.femaleSelectedFunc,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return AnimatedPadding(
      padding: MediaQuery.of(context).viewInsets,
      duration: Duration(milliseconds: 100),
      child: Container(
        width: PxUtil.instance.screenWidth,
        padding: EdgeInsets.only(
          bottom: PxUtil.instance.px_10,
          top: PxUtil.instance.px_10,
        ),
        color: ColorUtil.instance.color_transparent,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            InkWellButton(
              onPressed: (){
                NavigatorUtil.goBack();
                if(maleSelectedFunc!=null)maleSelectedFunc();
              },
              child: GradientCardView(
                elevation: PxUtil.instance.px_0,
                width: PxUtil.instance.screenWidth-PxUtil.instance.px_30,
                height: PxUtil.instance.px_46,
                alignment: Alignment.center,
                margin: EdgeInsets.only(),
                padding: EdgeInsets.only(),
                gradient: LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                      ColorUtil.instance.color_7776FF,
                      ColorUtil.instance.color_AD2CF1,
                    ]
                ),
                borderRadius: BorderRadius.circular(
                    PxUtil.instance.px_8),
                child: Container(
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    color: ColorUtil.instance.color_white,
                    borderRadius: BorderRadius.circular(
                        PxUtil.instance.px_8),
                  ),
                  padding: EdgeInsets.only(
                    left: PxUtil.instance.px_12,
                    right: PxUtil.instance.px_12,
                    // top: PxUtil.instance.px_5,
                    // bottom: PxUtil.instance.px_5,
                  ),
                  child:Center(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        ImagesUtil.loadAssetImage(
                            DrawableUtil.instance.icon_person_male,
                            height: PxUtil.instance.px_16,
                            fit: BoxFit.fitHeight
                        ),
                        SizedBox(width: PxUtil.instance.px_10,),
                        Text(
                          StringUtil.instance.Male,
                          style: TextStyle(
                            color: ColorUtil.instance.color_4D82FF,
                            fontWeight: FontWeight.w500,
                            fontSize: PxUtil.instance.px_14
                          ),
                        )
                      ],
                    ),
                  )
                ),
              ),
            ),
            InkWellButton(
              onPressed: (){
                NavigatorUtil.goBack();
                if(femaleSelectedFunc!=null)femaleSelectedFunc();
              },
              child: GradientCardView(
                elevation: PxUtil.instance.px_0,
                width: PxUtil.instance.screenWidth-PxUtil.instance.px_30,
                height: PxUtil.instance.px_46,
                alignment: Alignment.center,
                margin: EdgeInsets.only(),
                padding: EdgeInsets.only(),
                gradient: LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                      ColorUtil.instance.color_7776FF,
                      ColorUtil.instance.color_AD2CF1,
                    ]
                ),
                borderRadius: BorderRadius.circular(
                    PxUtil.instance.px_8),
                child: Container(
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    color: ColorUtil.instance.color_white,
                    borderRadius: BorderRadius.circular(
                        PxUtil.instance.px_8),
                  ),
                  padding: EdgeInsets.only(
                    left: PxUtil.instance.px_12,
                    right: PxUtil.instance.px_12,
                    // top: PxUtil.instance.px_5,
                    // bottom: PxUtil.instance.px_5,
                  ),
                  child: Center(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        ImagesUtil.loadAssetImage(
                            DrawableUtil.instance.icon_person_female,
                            height: PxUtil.instance.px_16,
                            fit: BoxFit.fitHeight
                        ),
                        SizedBox(width: PxUtil.instance.px_10,),
                        Text(
                          StringUtil.instance.Female,
                          style: TextStyle(
                              color: ColorUtil.instance.color_FC45BB,
                              fontWeight: FontWeight.w500,
                              fontSize: PxUtil.instance.px_14
                          ),
                        )
                      ],
                    ),
                  )
                ),
              ),
            ),
            SizedBox(height: PxUtil.instance.px_18,),
            InkWellButton(
              onPressed: (){
                NavigatorUtil.goBack();
                if(cancelSelectedFunc!=null)cancelSelectedFunc();
              },
              child: GradientCardView(
                elevation: PxUtil.instance.px_0,
                width: PxUtil.instance.screenWidth-PxUtil.instance.px_30,
                height: PxUtil.instance.px_46,
                alignment: Alignment.center,
                gradient: LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                      ColorUtil.instance.color_7776FF,
                      ColorUtil.instance.color_AD2CF1,
                    ]
                ),
                padding: EdgeInsets.only(
                  left: PxUtil.instance.px_12,
                  right: PxUtil.instance.px_12,
                  // top: PxUtil.instance.px_5,
                  // bottom: PxUtil.instance.px_5,
                ),
                borderRadius: BorderRadius.circular(
                    PxUtil.instance.px_8),
                child: ImagesUtil.loadAssetImage(
                    DrawableUtil.instance.icon_button_cancel,
                    height: PxUtil.instance.px_14,
                    fit: BoxFit.fitHeight
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
